package cn.apthink.mybatisplus;

import org.apache.ibatis.reflection.MetaObject;
import org.noear.solon.annotation.Component;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;

import cn.apthink.utility.DateUtil;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@Component
public class MetaObjectHandlerImpl implements MetaObjectHandler {

    public MetaObjectHandlerImpl() {
		super();
		log.debug("=>MetaObjectHandlerImpl create!");
	}

	@Override
    public void insertFill(MetaObject metaObject) {
        log.debug("=>insert fill ....");
        this.strictInsertFill(metaObject, "createtime", String.class, DateUtil.now()); // 起始版本 3.3.0(推荐使用)
    }

    @Override
    public void updateFill(MetaObject metaObject) {
        log.debug("=>update fill ....");
        this.strictUpdateFill(metaObject, "updatetime", String.class, DateUtil.now()); // 起始版本 3.3.0(推荐)
    }
}
